


#ifndef SNAP_H
#define SNAP_H

#include "SensorNotify.h"
#include "SpeedMonitor.h"

#include <qobject.h>


typedef struct SnapItem
{
	int type;
	int len;
}SnapItem;

#define MAXITEM_CNT 4096 
class Snap : public SensorNotify 
{
	Q_OBJECT
	public:
		Snap(SpeedMonitor* speedMonitor, bool isFront);
		~Snap();

		void update(const SensorState& state);
		void clearForNext();
		const SnapItem* info(int* cnt);
	public slots:
		void reset();

	private:
		SpeedMonitor* m_speedMonitor;
		SnapItem m_snapItemA[MAXITEM_CNT];
		SnapItem m_snapItemB[MAXITEM_CNT];


		int m_indexPre;
		int m_indexNow;
		SnapItem* m_pre;
		SnapItem* m_now;

		SensorState m_oldState;

		int m_counter;
		bool m_isFront;
};
#endif
